package org.pwwong.fxscalautils.components.affects

import org.pwwong.scalautils.time.Duration
import org.pwwong.scalautils.time.Predef._

object Effect {
  protected[Effect] abstract class Property[T](private var curValue:T) {
    type EffectType <: Effect[_]
    protected val effect:EffectType
    def apply():T = curValue
    def apply(newValue:T):EffectType = {curValue = newValue; effect}
  }
}

abstract class Effect[T<:Component]() { self:Effect[T] =>
  def Property[PType](initVal:PType) = new Effect.Property[PType](initVal){
    override type EffectType = self.type
    override protected val effect:self.type = self
  }
  def affect(comp:T)
}

class Pulse extends Effect[Component]{
  val duration = Property[Duration](1 secs)
  val repeat = Property[Int](1)
  override def affect(comp:Component) {
    
  }
}